package fun.easycode.jointblock.adpter.api;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import fun.easycode.jointblock.core.Constant;
import fun.easycode.jointblock.core.ExecutorContext;
import fun.easycode.jointblock.core.PageDto;
import fun.easycode.jointblock.service.dto.ArticlePagingQry;
import fun.easycode.jointblock.service.dto.data.ArticlePagingDto;
import fun.easycode.jointblock.service.executor.ArticlePagingQryExe;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ArticleRestController {

    @ApiOperationSupport(author = "类成旭",order = 1)
    @ApiOperation(value = "用户的阅读列表",notes = "列表根据发布时间倒序排列，查询自己的阅读列表展示所有状态的阅读文章，"
            + "查看别人的能看机审通过、到达发布时间、并且不是草稿、不是驳回的阅读文章")
    @GetMapping("/articles")
    @ApiImplicitParams({
            @ApiImplicitParam(name = Constant.CURRENT_USER_ID_HEADER, paramType = "header"),
            @ApiImplicitParam(value = "用户ID", name = "userId")
    })
    public ResponseEntity<PageDto<ArticlePagingDto>> myReadList(ArticlePagingQry qry) {
        return ResponseEntity.ok(ExecutorContext.get(ArticlePagingQryExe.class).execute(qry));
    }
}
